package com.zr.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.zr.model.User;
import com.zr.service.TealsjlServiceljc;
import com.zr.serviceImpl.TealsjlServiceImplljc;

import net.sf.json.JSONObject;
//教师个人申请记录
public class TealsjuControllerljc extends HttpServlet{
	TealsjlServiceljc l =new  TealsjlServiceImplljc();
	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		doPost(req, resp);
	}
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		req.setCharacterEncoding("utf8");
		resp.setCharacterEncoding("utf8");
		int page = Integer.parseInt(req.getParameter("page"));
		int rows = Integer.parseInt(req.getParameter("rows"));
		HttpSession session = req.getSession();
		User u  = (User)session.getAttribute("User");
		int tid = u.getTid();
		String tname = l.findTnameBytid(tid);
		PrintWriter pw = resp.getWriter();
		JSONObject j = l.findTeaJLByTname(page, rows, tname);
		pw.write(j.toString());
		pw.flush();
		pw.close();	
	}
}
